#include <stdio.h>


char *
simple_strncpy (char *dst, const char *src, size_t n)
{
	char *ret = dst;
	while (n--)
		if ((*dst++ = *src++) == '\0')
		{
			while (n--)
				*dst++ = '\0';
			return ret;
		}
		
		return ret;
}

static void _main( void )
{
	char string[100] = "Cats are nice usually";
	printf ( "Before: %s\n", string );
	simple_strncpy( string, "Dogs", 4 );
	simple_strncpy( string + 9, "mean", 4 );
	printf ( "After:  %s\n", string );
}